home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PBLIB1 / SKEL / SKEL3.PAS < prev    next >
Pascal/Delphi Source File  |  1994-05-03  |  3KB  |  101 lines

  1. PROGRAM SKEL3;
  2.  
  3. {$M 20000,0,655000}
  4.  
  5. Uses DOS, PbCRT, PbMISC, PbDATA, PbPARMS, PbOUT0;
  6.  
  7. {
  8. Description : Skeleton for CRT Interactive program
  9.  
  10. Author      : Howard Richoux
  11. Date        : 12/9/93
  12. Last revised: 12/15/93 hnr cleanup
  13. Application : IBM PC and compatibles, done in Turbo Pascal 7.0
  14. Status      :
  15. Published in: none
  16.  
  17. Intended Use:
  18.      Simple NON-page mode use of CRT.  Prompt is placed on screen
  19. and commands are accepted until <quit> or whatever. NO Function keys
  20. are implemented.  First use of this mode is TP, my own 'IDE'.
  21.  
  22. Commands can also be accepted from a command file @<fname>
  23.  
  24. SKEL3a will start here and go on farther.
  25.  
  26. Config Parameters        meaning                      Default
  27. PROMPT=xxxx              CRT prompt string            '->'
  28. }
  29.  
  30.  
  31. const typInputCRT = 1;          { Commands are coming from keyboard }
  32. const typInputFIL = 2;          { Commands are coming from file }
  33.  
  34. var   prompt    : string;       { Interactive mode prompt }
  35. var   InputType : integer;
  36.  
  37. {*****************************************************************}
  38.  
  39. Procedure GetCRTInput(prompt : string; var s,cmd : string);
  40.      begin
  41.      write(prompt);
  42.      GetKeyInput(s,cmd);
  43.      writeln('');
  44.      end;
  45.  
  46.  
  47. Procedure ProcessInput(var str,cmd : string);
  48.      begin
  49.      writeln('     str=[',str,']   cmd[',cmd,']');
  50.      end;
  51.  
  52.  
  53. Procedure MainInputLoop;
  54. var str,cmd : string;
  55. var i     : integer;
  56.      begin
  57.      i := 0; str := ''; cmd := '?STRING';
  58.      while (cmd <> '?EXIT') and (cmd <> '?ESCAPE') do
  59.           begin
  60.           case InputType of
  61.                  typInputCRT : GetCRTInput(prompt,str,cmd);  {SEE PbCRT}
  62.                  typInputFIL : begin
  63.                                writeln('FILE input not implemented yet.');
  64.                                exit;
  65.                                end
  66.                  else          begin
  67.                                writeln('MAIN Input loop - bad input type [',
  68.                                         InputType,']');
  69.                                cmd := '?ESCAPE';
  70.                                end;
  71.                  end;
  72.           ProcessInput(str,cmd);
  73.           inc(i); if i > 100 then cmd := '?ESCAPE';   {safety valve}
  74.           end;
  75.      end;
  76.  
  77.  
  78. Procedure Init;
  79. var s : string;
  80.      begin
  81.      InputType := typInputCRT;     {Note. File input not yet implemented }
  82.      AddParm(1,'PROMPT','->');     {default}
  83.  
  84.      StandardOUTInit;
  85.  
  86.      prompt   := GetParmStr('PROMPT');
  87.      end;
  88.  
  89.  
  90. (*  Main program *)
  91.      BEGIN
  92.      pProgID := 'SKEL3 1.02';
  93.      writeln(' ( Escape to quit ) ');
  94.      writeln('');
  95.      Init;
  96.      MainInputLoop;
  97.      OUTdone;
  98.      end.
  99.  
  100.  
  101.